import React, { Component } from 'react'
import qs from 'query-string';

export default class Detail extends Component {
  render() {  
    console.log('detail', this.props)
    //(1)接受params参数
    // const {id, title} = this.props.match.params || {};

    //(2)接受search参数
    // const {id, title} = qs.parse(this.props.location.search.slice(1));

    //(3)接受state参数
    const {id, title} = this.props.location.state || {}

    //history上面还有很多例如，goForward, goBack等
    return (
      <div>
        <ul>
            <li>Id: {id}</li>
            <li>Title: {title}</li>
        </ul>
      </div>
    )
  }
}
